﻿using System;
using System.ComponentModel;
using VNet.VisiSuite.Common.Resource;

namespace VNet.VisiSuite.VisiAdmin.Models
{
    public class ScheduleRepeatModel : ComparableBaseModel<ScheduleRepeatModel>, IDataErrorInfo
    {


        private int _scheduleRepeatId;
        public int ScheduleRepeatID
        {
            get { return _scheduleRepeatId; }
            set
            {
                _scheduleRepeatId = value;
                OnPropertyChanged("ScheduleRepeatID");
            }
        }

        private bool _isOneTime;

        [Category("Properties")]
        [DisplayName("IsOneTime")]
        [Description("IsOneTime")]
        public bool IsOneTime
        {
            get { return _isOneTime; }
            set
            {
                _isOneTime = value;
                OnPropertyChanged("IsOneTime", true);
            }
        }

        private bool _isEveryMonday;

        [Category("Properties")]
        [DisplayName("IsEveryMonday")]
        [Description("IsEveryMonday")]
        public bool IsEveryMonday
        {
            get { return _isEveryMonday; }
            set
            {
                _isEveryMonday = value;
                OnPropertyChanged("IsEveryMonday", true);
            }
        }

        private bool _isEveryTuesday;

        [Category("Properties")]
        [DisplayName("IsEveryTuesday")]
        [Description("IsEveryTuesday")]
        public bool IsEveryTuesday
        {
            get { return _isEveryTuesday; }
            set
            {
                _isEveryTuesday = value;
                OnPropertyChanged("IsEveryTuesday", true);
            }
        }

        private bool _isEveryWednesday;

        [Category("Properties")]
        [DisplayName("IsEveryWednesday")]
        [Description("IsEveryWednesday")]
        public bool IsEveryWednesday
        {
            get { return _isEveryWednesday; }
            set
            {
                _isEveryWednesday = value;
                OnPropertyChanged("IsEveryWednesday", true);
            }
        }

        private bool _isEveryThursday;

        [Category("Properties")]
        [DisplayName("IsEveryThursday")]
        [Description("IsEveryThursday")]
        public bool IsEveryThursday
        {
            get { return _isEveryThursday; }
            set
            {
                _isEveryThursday = value;
                OnPropertyChanged("IsEveryThursday", true);
            }
        }

        private bool _isEveryFriday;

        [Category("Properties")]
        [DisplayName("IsEveryFriday")]
        [Description("IsEveryFriday")]
        public bool IsEveryFriday
        {
            get { return _isEveryFriday; }
            set
            {
                _isEveryFriday = value;
                OnPropertyChanged("IsEveryFriday", true);
            }
        }

        private bool _isEverySaturday;

        [Category("Properties")]
        [DisplayName("IsEverySaturday")]
        [Description("IsEverySaturday")]
        public bool IsEverySaturday
        {
            get { return _isEverySaturday; }
            set
            {
                _isEverySaturday = value;
                OnPropertyChanged("IsEverySaturday", true);
            }
        }

        private bool _isEverySunday;

        [Category("Properties")]
        [DisplayName("IsEverySunday")]
        [Description("IsEverySunday")]
        public bool IsEverySunday
        {
            get { return _isEverySunday; }
            set
            {
                _isEverySunday = value;
                OnPropertyChanged("IsEverySunday", true);
            }
        }

        private bool _isDayOfMonth;

        [Category("Properties")]
        [DisplayName("IsDayOfMonth")]
        [Description("IsDayOfMonth")]
        public bool IsDayOfMonth
        {
            get { return _isDayOfMonth; }
            set
            {
                _isDayOfMonth = value;
                OnPropertyChanged("IsDayOfMonth", true);
            }
        }


        public TimeSpan _startTime;
        [Category("Properties")]
        [DisplayName("StartTime")]
        [Description("StartTime")]
        public TimeSpan StartTime
        {
            get { return _startTime; }
            set
            {
                _startTime = value;
                OnPropertyChanged("StartTime", true);
              
            }
        }

        public TimeSpan _endTime;
        [Category("Properties")]
        [DisplayName("EndTime")]
        [Description("EndTime")]
        public TimeSpan EndTime
        {
            get { return _endTime; }
            set
            {
                _endTime = value;
                OnPropertyChanged("EndTime", true);
              
            }
        }

        private DateTime _startDate;
        [Category("Properties")]
        [DisplayName("StartDate")]
        [Description("StartDate")]
        public DateTime StartDate
        {
            get { return _startDate; }
            set
            {
                _startDate = value;
                OnPropertyChanged("StartTime", true);
            }
        }

        private DateTime _endDate;
        [Category("Properties")]
        [DisplayName("EndDate")]
        [Description("EndDate")]
        public DateTime EndDate
        {
            get { return _endDate; }
            set
            {
                _endDate = value;
                OnPropertyChanged("EndDate", true);
            }
        }

        public string this[string columnName]
        {
            get
            {
                if (!ShouldValidate)
                    return string.Empty;

                //if (columnName == "Subject" && string.IsNullOrWhiteSpace(Subject))
                //    return ValidationMessages.DescriptionRequired;

                return string.Empty;
            }
        }

        public string Error { get { return string.Empty; } }


        #region Override Equals methods
        public bool Equals(ScheduleModel other)
        {

            //if (ReferenceEquals(null, other))
            //    return false;
            //if (ReferenceEquals(this, other))
            //    return true;

            return false;
            //    ScheduleId == other.ScheduleId
            //    && AreaId == other.AreaId
            //    && ReasonCodeId == other.ReasonCodeId
            //    && string.Equals(Subject, other.Subject)
            //    && StartTime  == other.StartTime 
            //    && EndTime == other.EndTime 
            //    && (ScheduleRepeatId ?? 0) == (other.ScheduleRepeatId ?? 0)
            //    && TimeStamp == other.TimeStamp;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
                return false;
            if (ReferenceEquals(this, obj))
                return true;
            if (obj.GetType() != this.GetType())
                return false;
            return Equals((ScheduleRepeatModel)obj);
        }

        //public override int GetHashCode()
        //{
        //    unchecked
        //    {
        //        return ScheduleRepeatId.GetHashCode();
        //    }
        //}
        #endregion


    }
}
